package com.nuotu.datawall.clouddata.view;

import android.app.AlertDialog;
import android.content.Context;

/**
 * Created by nuotu on 2017-11-30.
 */
public class MyDialog extends AlertDialog {
    private OnBeforeDismissListener onBeforeDismissListener;

    public MyDialog(Context context) {
        super(context);
    }

    public MyDialog(Context context, int themeResId) {
        super(context, themeResId);
    }

    protected MyDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }


    public interface OnBeforeDismissListener {
        void onDismiss();
    }

    public void setOnBeforeDismissListener(OnBeforeDismissListener onBeforeDismissListener) {
        this.onBeforeDismissListener = onBeforeDismissListener;
    }

    @Override
    public void dismiss() {
        if (onBeforeDismissListener != null) {
            onBeforeDismissListener.onDismiss();
        }
        super.dismiss();
    }
}